package com.xwd.dao.impl;

import com.xwd.dao.DBUtils;
import com.xwd.dao.GradeDao;
import com.xwd.domain.Grade;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class GradeDaoImpl extends DBUtils implements GradeDao {


    @Override
    public List<Grade> getClassTotalName() {
        List list= new ArrayList();
        try {
            String sql = "select * from grade ";
            resultSet = query(sql, null);
            while (resultSet.next()){
                Grade grade = new Grade();
                grade.setGradeId(resultSet.getInt("gradeId"));
                grade.setGradeName(resultSet.getString("gradeName"));
                list.add(grade);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            closeAll();
        }
        return list;
    }
}
